import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;

/**
 * 
 * @author qichun(chunqi_sh@126.com)
 * @date  May 30, 2013 10:54:46 AM
 */
public class CopyFile2 {

	public static void main(String[] args) throws FileNotFoundException {
		String filePath = "C:/Users/Administrator/Desktop/bill/123.pdf";
		String path = "C:/Users/Administrator/Desktop/bill/crt/"; 
		File file = new File(filePath);
		
		for(long i = 2013053000001l; i< 20130530000151l;i++){
			String name = "SG_"+ i +".pdf";
			saveFile(file, path + name);
		}
		
	}
	
	public static void saveFile(File file , String newFilePath){
		try {
			InputStream is = new FileInputStream(file);
			OutputStream os = new FileOutputStream(new File(newFilePath));
			byte[] b = new byte[1024];
			while(is.read(b) != -1){
				os.write(b);
			}
			os.close();
			is.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
}
